package liecai_class.day06;

/**
 * 二叉树的节点类
 */
public class BTNode <E> {
    private E data;
    private BTNode<E> leftChild;
    private BTNode<E> rightChild;

    public BTNode(E data) {
        this.data = data;
    }

    public BTNode(E data, BTNode<E> leftChild, BTNode<E> rightChild) {
        this.data = data;
        this.leftChild = leftChild;
        this.rightChild = rightChild;
    }

    public E getData() {
        return data;
    }

    public void setData(E data) {
        this.data = data;
    }

    public BTNode<E> getLeftChild() {
        return leftChild;
    }

    public void setLeftChild(BTNode<E> leftChild) {
        this.leftChild = leftChild;
    }

    public BTNode<E> getRightChild() {
        return rightChild;
    }

    public void setRightChild(BTNode<E> rightChild) {
        this.rightChild = rightChild;
    }

    @Override
    public String toString() {
        return " " + data + " "+leftChild +" "+rightChild;
    }
}
